﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using OrganizedIN.DAL;
using OrganizedIN.BussinessServices;
using System.Data.SqlClient;
namespace OrganizedIN.BAL
{
    public class BLL
    {
        public ArrayList UserLogin(User_Login objc)
        {
           try
            {
                DataAccessLayer d = new DataAccessLayer();
                return d.UserLogin(objc);
            }
            catch (Exception es)
            {
                throw es;
            }
        }
        public void UserRegistrationInsert(UserRegistration objc)
        {
            try
            {
                DataAccessLayer d = new DataAccessLayer();
                d.UserRegistrationInsert(objc);
            }
            catch (Exception es)
            {
                throw es;
            }
        }
        public void GroupRegistrationInsert(UserRegistration objc)
        {
            try
            {
                DataAccessLayer d = new DataAccessLayer();
                d.GroupRegistrationInsert(objc);
            }
            catch (Exception es)
            {
                throw es;
            }
        }
        public void ProfileDocumentInsert(MyProfileDocument objc)
        {
            try
            {
                DataAccessLayer d = new DataAccessLayer();
                d.ProfileDocumentInsert(objc);
            }
            catch (Exception es)
            {
                throw es;
            }
        }
        public DataSet ProfileDocument(MyProfileDocument objc)
        {
            try
            {
                DataAccessLayer d = new DataAccessLayer();
                return d.ProfileDocumentFetch(objc);

            }
            catch (Exception es)
            {
                throw es;
            }
        }
        public DataSet ProfileDocSearch(string UserName, string strSubject, string dtmTodoDate, string strPriority,string strRating,string strSort)
        {
            try
            {
                DataAccessLayer d = new DataAccessLayer();
               return d.ProfileDocSearch(UserName, strSubject, dtmTodoDate, strPriority, strRating, strSort);
            }
            catch (Exception e)
            {
                throw e;
            }
        }

        public  DataSet Doc_Redate(string strTodoIds, string dtmRedate)
        {
            DataAccessLayer d = new DataAccessLayer();
            return d.Doc_ReDate(strTodoIds, dtmRedate);
        }

        public DataSet Doc_Rename(string strTodoIds,string strDocRename)
        {
            DataAccessLayer d = new DataAccessLayer();
            return d.Doc_Rename(strTodoIds, strDocRename);
        }

        public DataSet Doc_Delete(string strTodoIds)
        {
            DataAccessLayer d = new DataAccessLayer();
            return d.Doc_Delete(strTodoIds);
        }
        public void PaymentSettingInsert(PaymentSet objc)
        {
            try
            {
                DataAccessLayer d = new DataAccessLayer();
                d.PaymentSetInsert(objc);
            }
            catch (Exception es)
            {
                throw es;
            }
        }
        public void LanguageSettingInsert(LanguageSet objc)
        {
            try
            {
                DataAccessLayer d = new DataAccessLayer();
                d.LanguageSetInsert(objc);
            }
            catch (Exception es)
            {
                throw es;
            }
        }

        public DataSet language_Name(LanguageSet objc)
        {
            try
            {
                DataAccessLayer d = new DataAccessLayer();
                return d.LanguageFetch(objc);

            }
            catch (Exception es)
            {
                throw es;
            }
        }
        public UserRegistration UserInformation(string user_name)
        {
            try
            {
                DataAccessLayer d = new DataAccessLayer();
                DataSet ds = d.UserInformationFatch(user_name);
                UserRegistration ur = new UserRegistration();
                if (ds.Tables[0].Rows.Count > 0)
                {
                   ur.ApproveEmail = ds.Tables[0].Rows[0]["ApproveEmail"].ToString();
                   ur.UserEmailID = ds.Tables[0].Rows[0]["username"].ToString();
                   ur.UserPassword = ds.Tables[0].Rows[0]["Password"].ToString();
                   ur.SecurityAns = ds.Tables[0].Rows[0]["SecurityAns"].ToString();
                   ur.SecurityPin = ds.Tables[0].Rows[0]["SecurityPin"].ToString();
                   ur.UserTimeZone = ds.Tables[0].Rows[0]["Time_Zone"].ToString();
                   ur.TruncateEmailSub = ds.Tables[0].Rows[0]["TruncateEmailSub"].ToString();
                   ur.UserFname = ds.Tables[0].Rows[0]["FirstName"].ToString();
                   ur.GlobalEmailoption = ds.Tables[0].Rows[0]["GlobalEmailoption"].ToString();

                   return ur;
                }
                return ur;
            }
            catch (Exception es)
            {
                throw es;
            }
        }
        public void UserRegistrationUpdate(UserRegistration objc)
        {
            try
            {
                DataAccessLayer d = new DataAccessLayer();
                d.UpdatePersonalInfo(objc);
            }
            catch (Exception es)
            {
                throw es;
            }
        }
        public DataSet Groupinformation(string user_name)
        {
            try
            {
                DataAccessLayer d = new DataAccessLayer();
                return d.GroupInformationFatch(user_name);

            }
            catch (Exception es)
            {
                throw es;
            }
        }
        public void UserGroupUpdate(GroupSettingInfo objc)
        {
            try
            {
                DataAccessLayer d = new DataAccessLayer();
                d.UpdateGroupInfo(objc);
            }
            catch (Exception es)
            {
                throw es;
            }
        }
        public PaymentSet GetCreditCardNo(string user_name)
        {
            try
            {
                DataAccessLayer ds = new DataAccessLayer();
                DataSet d = ds.GetCardInformation(user_name);
                PaymentSet ps = new PaymentSet();                
                if (d.Tables[0].Rows.Count > 0)
                {
                    ps.CreaditCard_No = d.Tables[0].Rows[0]["CreaditCardNo"].ToString();
                    ps.Expiration_Month = d.Tables[0].Rows[0]["Expiration_Month"].ToString();
                    ps.Expiration_Year = d.Tables[0].Rows[0]["Expiration_year"].ToString();
                   return ps;
                }
                return null;                 
            }
            catch (Exception es)
            {
                throw es;
            }
        }

        public void MediaInsert(MyProfileMedia objc)
        {
            try
            {
                DataAccessLayer d = new DataAccessLayer();
                d.AddMedia_Insert(objc);
            }
            catch (Exception es)
            {
                throw es;
            }
        }
        public void Media_AddArchive(string MediaID)
        {
            DataAccessLayer d = new DataAccessLayer();
            d.Media_AddArchive(MediaID);
        }

        public DataSet MediaFetch_Archive(string user_name)
        {
            try
            {
                DataAccessLayer d = new DataAccessLayer();

                return d.MediaFetch_Archive(user_name);

            }
            catch (Exception e)
            {
                throw e;
            }

        }
        public DataSet MediaFetch(string user_name)
        {
            try
            {
                DataAccessLayer d = new DataAccessLayer();

                return d.MediaFetch(user_name);

            }
            catch (Exception e)
            {
                throw e;
            }

        }
        public DataSet MediaSearch(string Title, string Subscription, string Share, string Rating, string Date, string username, string Type, string sort)
        {
            try
            {
                DataAccessLayer d = new DataAccessLayer();

                return d.MediaSearch(Title, Subscription, Share, Rating, Date, username, Type, sort);

            }
            catch (Exception e)
            {
                throw e;
            }

        }

        public void Media_ADDRATING(string MediaID, string Rating)
        {
            DataAccessLayer d = new DataAccessLayer();
            d.Media_ADDRATING(MediaID, Rating);
        }
        public void Media_Rename(string MediaID, string Name)
        {
            DataAccessLayer d = new DataAccessLayer();
            d.Media_Rename(MediaID, Name);
        }

        public DataSet MediaFetch_BookMark(string user_name)
        {
            try
            {
                DataAccessLayer d = new DataAccessLayer();

                return d.MediaFetch_BookMark(user_name);

            }
            catch (Exception e)
            {
                throw e;
            }

        }

        public DataSet Media_FetchMedia_ID()
        {
            try
            {
                DataAccessLayer d = new DataAccessLayer();

                return d.Media_FetchMedia_ID();

            }
            catch (Exception e)
            {
                throw e;
            }

        }

        public void MediaDelete(string MediaID)
        {
            DataAccessLayer d = new DataAccessLayer();
            d.MediaDelete(MediaID);
        }


        public void AddMediaOnline_Insert(MyProfileMedia objc)
        {
            try
            {
                DataAccessLayer d = new DataAccessLayer();
                d.AddMediaOnline_Insert(objc);
            }
            catch (Exception es)
            {
                throw es;
            }
        }

        public DataSet Media_FetchBookmark(string Media_ID)
        {
            try
            {
                DataAccessLayer d = new DataAccessLayer();

                return d.Media_FetchBookmark(Media_ID);

            }
            catch (Exception e)
            {
                throw e;
            }

        }

        public DataSet Authentication()
        {
            try
            {
                DataAccessLayer d = new DataAccessLayer();
                return d.Authentication();

            }
            catch (Exception es)
            {
                throw es;
            }
        }

        public DataSet AccountLocked_Fetch(string UserID)
        {
            try
            {
                DataAccessLayer d = new DataAccessLayer();
                return d.AccountLocked_Fetch(UserID);

            }
            catch (Exception es)
            {
                throw es;
            }
        }
      
    }
}
